home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / handle20.zip / TSR.TXT < prev   
Text File  |  1987-07-15  |  19KB  |  362 lines

  1.  
  2.                                                      July 1987
  3.  
  4.                       The History and Technology
  5.               of TSR Terminate and Stay Resident software
  6.  
  7.                                   by
  8.                              Steve Gibson
  9.                    InfoWorld TechTalk Columnist and
  10.                   President of Gibson Research Corp.
  11.  
  12.  
  13.                             HISTORY BEGINS
  14. ----------------------------------------------------------------------
  15. Once upon a time a Big Blue company named IBM decided that it wanted 
  16. to make personal computers too.  For reasons known only to the Gods of 
  17. Boca Raton Florida, IBM decided to use the 8088 microcomputer from 
  18. Intel rather than Motorola's vastly "cleaner" 68000 (as is used in 
  19. Apple's macintosh).  Viewed in retrospect, this has turned out to be a 
  20. ridiculously expensive, i.e. WRONG, decision.  But anyway... IBM 
  21. journeyed to the West to get its software for this new machine.  
  22.  
  23. IBM first visited the company who was then the acknowledged king of 
  24. operating systems, Digital Research, Inc.  DRI had developed CP/M, the 
  25. defacto standard operating system for the very popular 8080 and Z80 
  26. microcomputer systems.  IBM explained that it needed an operating 
  27. system for the new 8088 microprocessor in their new, blue, personal 
  28. computer and asked if DRI would please provide them with one.  DRI 
  29. said, quite truthfully, that they didn't have one.  Big blue must have 
  30. then asked if they would like to make one, to which DRI must have 
  31. again said: "No thanks." 
  32.  
  33. IBM shrugged and headed North. . . . . 
  34.  
  35. Though IBM may have only planned to ask Microsoft for an 8088 BASIC 
  36. language interpreter for their new machine, they found themselves in 
  37. Washington without an operating system.  Microsoft said they would be 
  38. pleased to provide IBM with both an 8088 operating system and the 
  39. BASIC language interpreter.  IBM said "Thank you" and said they needed 
  40. it very soon please. 
  41.  
  42. But Microsoft didn't have an 8088 operating system either, and being 
  43. so very much smaller then than now, didn't have the resources to build 
  44. one from scratch by IBM's deadline.  So they found an even tinier 
  45. company called Seattle Computer who had built a little unpretentious 
  46. operating system for the 8088 and 8086 micros called 86-DOS.  It was 
  47. also known by some as QDOS.  QDOS was said to stand for Quick and 
  48. Dirty Operating System. 
  49.  
  50. So Microsoft, then able to meet IBM's 8088 machine timetable, 
  51. delivered both an operating system (albeit one of unassuming parentage 
  52. and questionable virtue) and a BASIC interpreter. 
  53.  
  54. Everything seemed fine until we all began really using the new 
  55. operating system.  We wanted additional and rather reasonable things 
  56. from MS-DOS and PC-DOS.  Things which had not been designed into 86-
  57. DOS, like printing in the background while the user was doing other 
  58. things.  Or supporting RS-232 serial printers, which required routing 
  59. the printer data out through a serial port instead of the normal 
  60. parallel printer port. 
  61.  
  62. To meet these reasonable demands Microsoft made a series of small 
  63. changes and additions to the guts of MS-DOS which allowed extra "add-
  64. on" code to be "hung" onto the outside of MS-DOS and also provided for 
  65. limited communication between DOS and the add-on code.  Microsoft's 
  66. idea was that these MS-DOS limitations would be "fixed" by writing 
  67. some new DOS commands (in the above examples PRINT and MODE) which 
  68. would make use of special undocumented aspects of their latest version 
  69. operating system. 
  70.  
  71. The problem was that MS/PC-DOS, still really old 86-DOS (QDOS) in 
  72. disguise, was never built to support multitasking.  This means that it 
  73. was never meant to serve more than a single master at a time.  A 
  74. command like PRINT, which can continue to operate even AFTER the user 
  75. has begun doing something else, could very easily confuse it, since 
  76. now there could be service requests coming into MS-DOS from two quite 
  77. different places at once. 
  78.  
  79. Since this began making the entire operating system rather fragile and 
  80. weird, Microsoft's grand plan was to retain all these special hooks 
  81. and communications paths as a company secret.  They figured that as 
  82. long as they were the only ones to use these new MS-DOS secrets things 
  83. wouldn't get out of hand. 
  84.  
  85. But Microsoft must have gravely underestimated the cleverness and 
  86. determination of the development community.  When the MODE command 
  87. proudly stated: "Resident portion installed" developer's eyebrows shot 
  88. up!  RESIDENT portion?  Hmmmmmm.  And if the PRINT command could 
  89. access the disk for file printing when we were messing around with a 
  90. spreadsheet, why couldn't we build a little resident notepad or two, 
  91. too? 
  92.  
  93. But EVEN after these new resident goodies began appearing in 
  94. increasing numbers, Microsoft refused to "disclose" anything 
  95. whatsoever.  They said they "couldn't" document these things or they'd 
  96. be forced to make all FUTURE versions of the operating system support 
  97. them in upwardly compatible fashion.  Since these were awkward 
  98. "kludge" solutions to the real need for a true multitasking operating 
  99. system, Microsoft's delicate condition can be readily understood. 
  100.  
  101. However, developers sensing massive market opportunities were not to 
  102. be stopped.  Debugging software which allowed programmers to peer 
  103. inside the still working machine sold like wildfire.  Using these 
  104. debuggers (like PERISCOPE, my personal favorite), developers probed 
  105. into the very heart of Microsoft's own PRINT and MODE commands, 
  106. unscrambling and deciphering the undocumented secrets of their 
  107. operation.  Using the same secrets Microsoft's own developers had 
  108. used, they learned how to give their OWN programs similar 
  109. capabilities. 
  110.  
  111. In an old episode of Star Trek, Mr. Spock said, after capturing the 
  112. Romulan's cloaking device, "...military secrets are the most fleeting 
  113. of all, Commander."  This applies equally well to technological 
  114. secrets in general, and as we've seen, to Resident Software in 
  115. particular! 
  116.  
  117. It's unfortunate that Microsoft did not have time back then in the 
  118. beginning to build their own DOS from scratch.  They might have done 
  119. it right.  But we're stuck with what we have today, and making the 
  120. most of it is certainly our best strategy. 
  121.  
  122. It remains unfortunate, though certainly understandable, that 
  123. Microsoft isn't willing to disclose the details of MS-DOS's resident 
  124. software hooks and techniques.  This policy keeps such knowledge quite 
  125. secret, since even the third-party developers are reluctant to 
  126. disclose their own hard-won "insider's" knowledge and proprietary 
  127. techniques for forcing reliable multitasking behavior from good ol' 
  128. single tasking DOS.  It's quite interesting to speculate that perhaps 
  129. today even Microsoft does not KNOW how to write MS-DOS multitasking 
  130. applications as well and robustly as several of the larger commercial 
  131. resident software publishers!  The tricks required to make DOS 
  132. multitask are real nasty stomach-turners. 
  133.  
  134. So... what are these tricks and techniques?  How DO resident programs 
  135. "pop up over" applications at the simple press of a "hot key"? 
  136.  
  137.  
  138.  
  139.                   THE TECHNOLOGY OF RESIDENT SOFTWARE
  140. ----------------------------------------------------------------------
  141.  
  142. Since we've now know how we got to wherever it is we are, let's answer 
  143. the those questions posed above.... 
  144.  
  145. Two things are required for the functioning of TSR technology:  First, 
  146. the TSR program needs to somehow "hang around" well after any other 
  147. program has started to run.  Secondly, it has to "know" what's going 
  148. on in the system to be able to jump in and help out when called upon 
  149. for action.  It also needs some way of re-assuming control of the 
  150. machine when the time comes for it to take action. 
  151.  
  152. The requirement of continuing RAM residency is satisfied by a service 
  153. provided by the operating system from which TSR's get their name: 
  154. Terminate and Stay Resident (TSR). 
  155.  
  156. The main operating RAM memory of an IBM compatible PC is a contiguous 
  157. block beginning at address zero (called the botto